import java.sql.Connection;
import java.sql.Drivermanager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

 public class DBManager
	{
	static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
	static final String DB_URL = "jdbc:mysql://localhost/EMP";
	static final String USER = "username";
	static final String PASS = "password" ;
	
	public ResultSet retriveData()
	{
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		
		try
		{
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(DB_URL,USER,PASS);
			stmt = conn.createStatement();
			String sql;
			sql = "SELECT id, first,last,age From Employees";
			rs = stmt.executeQuery(sql);
			return rs;
		}
			catch(SQLException se)
 			    {
					se.printStackTrace();
				}
				catch(Exception e)
				{
					e.printStackTrace();
				}
					finally
					{
						try
						{
							if(conn != null)
								conn.close();
							if(stmt != null)
								stmt.close();
						}catch(SQLException se)
						{
							se.printStackTrace();
						}	
					}
			return rs;
		}
	}	